package jccr;

public interface Dispatcher {

	/**
	 * Attaches a new queue to the dispatcher. Dispatcher queues are
	 * served in a a round robin fashion.
	 * @param queue the queue to attach.
	 */
	void attach( DispatcherQueue queue );
	
	/**
	 * Disposes the dispatcher and terminates all threads in a controlled manner.
	 */
	void dispose() throws InterruptedException;

	/**
	 * Get the name of the thread pool.
	 * @return the name of the pool.
	 */
	String getName();
	
	/**
	 * Gets the number of workers in the dispatcher.
	 * @return the number of workers.
	 */
	int getWorkerCount();
	
	/**
	 * Checks if the dispatcher is idle; IE all threads are waiting.
	 * @return true if idle, otherwise false
	 */
	boolean isIdle();
}
